﻿<?php 
include_once("../../includes/metodos.php");
include_once("action.php");

checkUser();
connectSql();

if(!empty($_REQUEST['cmd']) && $_REQUEST['cmd']=='edit'){
	if($_POST['nova'] != $_POST['confirmacao']){
		$alerta = '<h2 style="color: red;">A nova senha n&atilde;o coincide com a confirm&ccedil;&atilde;o</h2><br/>';
	}else{
		edit($_POST['id']);
	}
	edit(anti_injection($_POST['id']));
}
include("../cabecalho.php");
$query = mysql_query("SELECT * FROM econ_usuarios WHERE id=".$_SESSION['id']);
$row = mysql_fetch_array($query);
?>
<div style="margin:0 auto;width:900px;">
	<form action="index.php" method="post" enctype="multipart/form-data">
	  <br>
	  <div style="width:695px;margin:0 auto;">
		<label id="label_apelido">Apelido</label>
		<input id="input_apelido" type="text" name="apelido" value="<?php echo $row['apelido'];?>"/>
		<label id="label_foto">Foto</label>
		<input id="input_foto" type="file" name="foto"/>
		<img style="float:right;" src="<?php echo $row['avatar'];?>" /><br><br>
		<label id="label_nv_senha" >Nova Senha</label>
		<input id="input_passaword" type="password" name="senha"/>
		<label id="label_conf_senha">Confirme a senha</label>
		<input id="iput_new_senha" type="password" name="confirmacao"/>
	  </div><br><br>
	  <div style="width:695px;margin:0 auto;">
		<textarea rows="" cols="" name="descricao"><?php echo $row['descricao']; ?></textarea>
		<input type="hidden" name="cmd" value="edit">
		<input type="hidden" name="id" value="<?php echo $_SESSION['id'];?>">
		<input type="submit" value="Editar"/>
	  </div>
	</form>
</div>